<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>龙凤电视台ONT注册脚本生成器</title>
	<style>
		html, body{margin: 0;}
		.head, .foot{background-color: #000;color: #fff;text-align: center;}
		.side{background-color: #a09540;}
		.main{background-color: #909540;}


		html, body{height: 100%;}
		body{display: flex;flex-flow: column;}
		.head, .foot{height: 70px;}
		.body{flex: 1;display: flex;}
		.side{width: 300px;}
		.main{flex: 1;}
	
	</style>
</head>
<body>
	<div class="head"><h1>龙凤矿电视台ONT注册脚本生成器 v1.0</div>

	<div class="body">
		<div class="side">

			
 <form action="表单接口" method="post">
             
             <fieldset>

				<br>
				
				<div>
					<label>终端序号：</label>
					<input type="text" size="4" id="onu-number">
				</div>
		
				
				<div>
					<label>终端--SN：48575443B5</label>
					<input type="text" size="4"  id="onu-sn">
					<label>40</label>
				</div>
             	
				
				
				<div>
					<label for="underwrite">终端别名：</label>
					<!-- <textarea name="underwrite" rows="1" cols="40" id="underwrite"></textarea> -->
					<input type="text" size="10" id="onu-desc">
				</div>
				<br>
				
				<br>
				<label >所属GPON端口</label><br><br>
				<div>
					<label >框..........</label>
					<select onclick="kuang_click(this)">
						<option id="onu-kuang" value="0">0号框</option>
						<option id="onu-kuang" value="1">1号框</option>
						<option id="onu-kuang" value="2">2号框</option>
						<option id="onu-kuang" value="3">3号框</option>
						<option id="onu-kuang" value="4">4号框</option>
						<option id="onu-kuang" value="5">5号框</option>
						<option id="onu-kuang" value="6">6号框</option>
						<option id="onu-kuang" value="7">7号框</option>
					</select>
				</div>
				
				<div>
					<label >槽..........</label>
					<select onclick="ban_click(this)">
						<option id="onu-ban" value="1">1号槽</option>
						<option id="onu-ban" value="2">2号槽</option>
						<option id="onu-ban" value="3">3号槽</option>
						<option id="onu-ban" value="4">4号槽</option>
						<option id="onu-ban" value="5">5号槽</option>
						<option id="onu-ban" value="6">6号槽</option>
						<option id="onu-ban" value="7">7号槽</option>
						<option id="onu-ban" value="8">8号槽</option>
					</select>
				</div>
				
				<div>
					<label >口..........</label>
					<select onclick="kou_click(this)">
						<option id="onu-kou" value="0">0号口</option>
						<option id="onu-kou" value="1">1号口</option>
						<option id="onu-kou" value="2">2号口</option>
						<option id="onu-kou" value="3">3号口</option>
						<option id="onu-kou" value="4">4号口</option>
						<option id="onu-kou" value="5">5号口</option>
						<option id="onu-kou" value="6">6号口</option>
						<option id="onu-kou" value="7">7号口</option>
						</select>
				</div>
				
				
 </fieldset> 

		</from>
		<br>
			<div style="text-align: center;">
				<br>
			<input type="button" value="生成ONT注册脚本" onclick="showhaha();" /><br><br>

			<input type="button" value="查看常用命令" onclick="showdisplay();" /><br><br>

			<input type="button" value="备用按钮" onclick="HandleExcel();" />
		</div>


	
		</div>


		<div class="main">


<script type="text/javascript">

var kuang="0"; ban="1"; kou="0";

function kuang_click(obj){
    this.kuang=(obj.value=='0'?'0':(obj.value=='1'?'1':(obj.value=='2'?'2':(obj.value=='3'?'3':(obj.value=='4'?'4':(obj.value=='5'?'5':(obj.value=='6'?'6':'7')))))));
}
;
function ban_click(obj){
    this.ban=(obj.value=='8'?'8':(obj.value=='1'?'1':(obj.value=='2'?'2':(obj.value=='3'?'3':(obj.value=='4'?'4':(obj.value=='5'?'5':(obj.value=='6'?'6':'7')))))));
}
;
function kou_click(obj){
    this.kou=(obj.value=='0'?'0':(obj.value=='1'?'1':(obj.value=='2'?'2':(obj.value=='3'?'3':(obj.value=='4'?'4':(obj.value=='5'?'5':(obj.value=='6'?'6':'7')))))));
}
;



function showhaha()
{
var number=document.getElementById("onu-number");
if (number.value<1||number.value>128){
	alert("生成代码无效：输入终端序号范围1至128之间");
}
var sn="48575443B5"+document.getElementById("onu-sn").value+"40";
//alert(document.getElementById("onu-sn").value.length);
if (document.getElementById("onu-sn").value.length<4||document.getElementById("onu-sn").value.length>4){
    alert("生成代码无效：请输入4位终端SN");
}
var desc=document.getElementById("onu-desc");
var gem="未获取正确GEM索引";
var ywvlan="未获取正确业务VLAN";
var glvlan="未获取正确业务模板";
var interfacegpon=kuang+"/"+ban;
switch(kou){
	case "0":
	gem="1"; ywvlan="2801" ; glvlan="103";
	break;
	case "1":
	gem="2"; ywvlan="2802" ; glvlan="104";
	break;
	case "2":
	gem="2"; ywvlan="2803" ; glvlan="104";
	break;
	case "3":
	gem="2"; ywvlan="2804" ; glvlan="104";
	break;
	case "4":
	gem="2"; ywvlan="2805" ; glvlan="104";
	break;
	case "5":
	gem="2"; ywvlan="2806" ; glvlan="104";
	break;
	case "6":
	gem="2"; ywvlan="2807" ; glvlan="104";
	break;
	case "7":
	gem="2"; ywvlan="2808" ; glvlan="104";
	break;


}


var gaga=document.getElementById("showgaga");

gaga.innerText ="telnet成功登陆后，直接复制下列代码即可:"+"\n"+"\n"+"en"+"\n"+"config"+"\n"+"switch language-mode"+"\n"+"\n"+"interface gpon "+interfacegpon+"\n"+"ont add "+kou+" "+number.value+" sn-auth "+sn+" omci ont-lineprofile-id "+glvlan+" ont-srvprofile-id "+glvlan+" desc "+desc.value+"\n"+"ont port native-vlan "+kou+" "+number.value+" eth 1 vlan "+ywvlan+"\n"+"\n"+"\n"+"quit"+"\n"+"service-port vlan "+ywvlan+" gpon "+interfacegpon+"/"+kou+" ont "+number.value+" gemport "+gem+" multi-service user-vlan "+ywvlan+" tag-transform translate"+"\n"+"\n"+"display board 0/1"+"\n"+"\n";

//alert(gaga.innerText);
}

function showdisplay(){
	var number=document.getElementById("onu-number");
	var sn=document.getElementById("onu-sn");
	var desc=document.getElementById("onu-desc");
	var gem=document.getElementById("onu-gem");
	var ywvlan=document.getElementById("onu-ywvlan");
	var glvlan=document.getElementById("onu-glvlan");
	var interfacegpon=kuang+"/"+ban;
	var gaga=document.getElementById("showgaga");
 
	gaga.innerText = "全局（config)下常用命令"+"\n" + "1. display board 0/1    ~查看1号板卡下所有ONU终端注册信息"+"\n"+"2. display service-port all  ~查看虚拟业务端口列表"+"\n"+"3. undo service-port x   ~删除 第X个 虚拟业务端口"+"\n"+"4. switch language-mode  ~切换显示语种" + "\n"+"\n"+"端口配置（interface gpon 0/1)模式下常用命令" + "\n" +"1. display board 0/1   ~查看1号板卡下所有ONU终端注册信息" +"\n"+"2. display ont info [端口号] [终端序号]           ~查看某端口下单个ONU注册信息"+"\n"+"3. ont delete [端口号] [终端序号]      ~删除某端口下的某个ONU终端(需先删除终端虚拟业务口）"+"\n"+"4. display ont optical-info [端口号] [终端序号]";
}

function showback(){
	var number=document.getElementById("onu-number");
	var sn=document.getElementById("onu-sn");

	var desc=document.getElementById("onu-desc");
	var gaga=document.getElementById("showgaga");


	gaga.innerText ="";
}

function HandleExcel(){  
  try {        
    var xls    = new ActiveXObject ( "Excel.Application" );  
     }  
    catch(e) {  
         alert( "您必须安装Excel电子表格软件，");  
         return "";  
     }  
    xls.visible =true;  
    //设置excel为可见  
    var xlBook = xls.Workbooks.Add;  
    var xlsheet = xlBook.Worksheets(1);  
    xlsheet.Range(xlsheet.Cells(1,1),xlsheet.Cells(1,7)).mergecells=true;  
   <!--设置行高-->  
    xlsheet.Rows(1).RowHeight = 25;  
    <!--设置字体 -->  
    xlsheet.Rows(1).Font.Size=14;  
    <!--设置字体 设置选定区的字体-->  
    xlsheet.Rows(1).Font.Name="黑体";  
    <!--设置列宽 -->  
    xlsheet.Columns("A:D").ColumnWidth =18;  
    <!--设置显示字符而不是数字-->  
    xlsheet.Columns(2).NumberFormatLocal="@";  
  
  xlsheet.Cells(2,1).Value="********";  
  
  //很重要,不能省略,不然会出问题 意思是excel交由用户控制  
  xls.UserControl = true;    
  xls=null;  
  xlBook=null;  
  xlsheet=null;  
}  



</script>
<br>


 <p style="font-size:18px ;font-weight:bold; color:#307010" id="showgaga">欢迎使用华为5680T GPON ONT注册脚本生成器，<br>此在线生成器生成“SN”认证ONU注册脚本代码，不支持 ”WINDOWS XP“系统（生成脚本功能正常，但会出现版面错乱情况，为加速XP更替，特此不做兼容代码。）<br><br> 请填写好各项后点击“生成脚本“按钮。<br><br> 如使用中发现BUG请联系  </p>
		





         </div>


	</div>

	<div class="foot">2015-10 <br>      <a href="http://fscatv.com/sudk001/images/weixin%202ma.jpg">联系编写者：点击查看微信二维码</a></div>
</body>
</html>